<style type="text/css">
@import "/templates/admin/js/dataTables/css/demo_table.css";
</style>
<script type="text/javascript" src="/templates/admin/js/dataTables/js/jquery.dataTables.js"></script>

{if $TBODY_TD}

{literal} 
<script type="text/javascript">
	$(document).ready(function() {
		var NowWrapTable = $('.nowraptable').dataTable( {
			"sDom":'Rlfrtip',
			"bStateSave": true,
			"aaSorting" : [],
			"aoData": [			
{/literal}
	{foreach $CFG_FIELD.aoData.bSortable as $key => $bool}
		{if $bool eq "null"}null,
		{else}{literal}{"bSortable":{/literal} {$bool} {literal}},{/literal}{/if}
	{/foreach}
{literal}
			]
		});		
	});
</script> 
{/literal}
    
<div id="confirm">{$CONFIRM}</div>
{if $DESC_INFO}
<ul class="message warning">
  <li>{$DESC_INFO}</li>
  <li class="close-bt"></li>
</ul>
{/if}
<form action="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}" method="post" id="pages_form_change">
  <input type="hidden" name="subaction" value="updateitems" />
  <table cellpadding="0" cellspacing="0" border="0" class="nowraptable">
    <thead>
      <tr> {if $CFG_FIELD.edit}
        <th>&nbsp;</th>
        {/if}
        {if $CFG_FIELD.delete}
        <th><a href="javascript:void(0);" class="select_delete" rel="delinput_{$MODE}"><img title="удалить все записи" src="/templates/admin/img/icons/delete.png" /></a></th>
        {/if}
        {if $CFG_FIELD.por}
        <th>Порядок</th>
        {/if}       
        {foreach $CFG_FIELD.field_cfg as $k => $v}
        <th width="{$v.width}" title="{$v.name}">{$v.name}</th>
        {/foreach} </tr>
    </thead>
    <tbody>
    
    {foreach $TBODY_TD as $tbody_item_key => $tbody_item_value}
    <tr> {if $CFG_FIELD.edit}
      <td><a href="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}&type=edit&pageid={$tbody_item_value.id}" title="Редактировать" class="ui-helper-clearfix ui-state-default ui-corner-all"><span class="ui-icon ui-icon-pencil"></span></a></td>
      {/if}
      {if $CFG_FIELD.delete}
      <td><input type="checkbox" class="delinput_{$MODE} mini-switch-delete" name="del[]" value="{$tbody_item_value.id}" /></td>
      {/if}
      {if $CFG_FIELD.por}
      <td><input type="text" name="por[{$tbody_item_value.id}]" value="{$tbody_item_value.por}" size="3" class="por_input" /></td>
      {/if}    
      {if $CFG_FIELD.field_cfg}{foreach $CFG_FIELD.field_cfg as $k => $v}
      <td title="{if is_array($v.fieldname)}{foreach $v.fieldname as $k_sysname => $v_sysname}{$tbody_item_value[$v_sysname]} {/foreach}{else}{$tbody_item_value[{$v.fieldname}]|strip_tags}{/if}" {$v.attr}>{if $v.link}<a href="?m={$ACT_NAME}&id={$smarty.get.id}&parent={$smarty.get.parent}&type=edit&pageid={$tbody_item_value.id}{if $IS_ACTIVE_GROUP}&active_group={$ACTIVE_GROUP_ID}{/if}">{/if}{if is_array($v.fieldname)}{foreach $v.fieldname as $k_sysname => $v_sysname}{$tbody_item_value[$v_sysname]} {/foreach}{else}{$tbody_item_value[{$v.fieldname}]|strip_tags}{/if}{if $v.link}</a>{/if}</td>
      {/foreach}{/if} </tr>
    {/foreach}
      </tbody>
    
  </table>
  <div class="clear"></div>
  <a href="javascript:void(0);" class="ui_wo_buttons change_button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span>Изменить</a>
</form>
         
{elseif $Field}
<form action="" method="post" enctype="multipart/form-data" id="form_submit" class="form_submit">
  {if $smarty.get.type eq "edit"}
  	<input type="hidden" name="type" value="editt" />
    <input type="hidden" name="id" value="{$smarty.get.pageid}" />
  {else}
  	<input type=hidden name="type" value="add" />
  {/if}
  
  <input type="hidden" name="parent" value="{$smarty.get.id}" />
  <div id="admin_tabs_main_content"> 
    <!-- TABS_NAME -->
    <ul>
      <li><a href="#General">Общие</a></li>
    </ul>
    <!-- END TABS_NAME --> 
    <!-- ОБЩИЕ -->
    <div id="dialog-form-alert"></div>
    <div id="General" style="width:730px;">  
      {if $smarty.get.type eq "edit"}
        <p class="position_name">Запись создана</p>
        <p class="position_input">{$Field.date|date_format:"%Y-%m-%d %H:%M:%S"}<input type="hidden" name="date" value="{$Field.date}" /></p>
      {/if}
      
      <p class="position_name">Порядок</p>
      <p class="position_input"><input type="text" name="por" value="{$Field.por}"></p>
              
      <p class="position_name">Битые ссылки</p>
      <p class="position_input"><input type="text" name="badlink" value="{$Field.badlink}"></p>
      
      <p class="position_name">Редирект</p>
      <p class="position_input"><input type="text" name="redirect" value="{$Field.redirect}"></p>
      
      <p class="position_name">IP</p>
      <p class="position_input"><input type="text" name="ip" value="{$Field.ip}"></p>
      
      <p class="position_name">Язык</p>
      <p class="position_input"><input type="text" name="lang" value="{$Field.lang}"></p>
      
      <p class="position_name">IP proxy</p>
      <p class="position_input"><input type="text" name="ipproxy" value="{$Field.ipproxy}"></p>
      
      <p class="position_name">Proxy</p>
      <p class="position_input"><input type="text" name="proxy" value="{$Field.proxy}"></p>       	  
      
      <p class="position_name">Клиент</p>
      <p class="position_input"><textarea name="client" rows="5">{$Field.client}</textarea></p>      
    </div>
  </div>
  <div id="posbutton">
    <a href="javascript:void(0);" class="ui_wo_buttons but_primenit ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span>Применить</a> 
    <a href="javascript:void(0);" class="ui_wo_buttons but_save ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Сохранить</a>
  </div>
</form>
<script type="text/javascript">
$(function()
{
	var eForm = $("#form_submit");
	$(".but_primenit").live("click", function(){
		eForm.attr("action", '?m=content&id={$smarty.get.id}&parent={$smarty.get.parent}&pageid={$ID_ACTION}&type=edit').submit();		
	});		
	$(".but_save").live("click", function(){
		eForm.attr("action", '?m=content&id={$smarty.get.id}&parent={$smarty.get.parent}').submit();
	});	
});
</script>
{else}
<div id="info_table" class="ui-state-error ui-corner-all">
  <p><span class="ui-icon ui-icon-alert" style="float:left;margin-right:.3em;"></span>
  <strong>Внимание!</strong> В выбранном разделе <strong>записей нет</strong></p>
</div>
{/if}